package com.wbcs.config.template.tags;

import com.wbcs.exception.WbcsRuntimeException;
import com.wbcs.system.ReportRequest;
import com.wbcs.system.assistant.TagAssistant;
import com.wbcs.system.component.AbsComponentType;
import com.wbcs.system.component.application.report.abstractreport.AbsReportType;
import com.wbcs.util.Consts_Private;

public class SDataTag extends AbsTagInTemplate
{
    public SDataTag(AbsTagInTemplate parentTag)
    {
        super(parentTag);
    }
    
    @Override
	public String getTagname()
    {
        return Consts_Private.TAGNAME_DATA;
    }
    
    @Override
	public String getDisplayValue(ReportRequest rrequest,AbsComponentType ownerComponentObj)
    {
        AbsComponentType displayComponentObj=this.getDisplayComponentObj(rrequest);
        if(displayComponentObj==null) displayComponentObj=ownerComponentObj;
        if(!(displayComponentObj instanceof AbsReportType))
        {
            throw new WbcsRuntimeException("组件"+displayComponentObj.getConfigBean().getPath()+"不是报表，不能调用<wx:data/>显示其数据部分");
        }
        return TagAssistant.getInstance().getReportDataPartDisplayValue((AbsReportType)displayComponentObj,this.mTagAttributes);
    }
}

